<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QDBusInterface Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDBusInterface Class Reference<br /><sup><sup>[<a href="qtdbus.html">QtDBus</a> module]</sup></sup></h1><p>The QDBusInterface class is a proxy for interfaces on remote
objects. <a href="#details">More...</a></p>

<p>Inherits <a href="qdbusabstractinterface.html">QDBusAbstractInterface</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdbusinterface.html#QDBusInterface">__init__</a></b> (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>&#160;=&#160;QString(), QDBusConnection&#160;<i>connection</i>&#160;=&#160;QDBusConnection.sessionBus(), QObject&#160;<i>parent</i>&#160;=&#160;None)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDBusInterface class is a proxy for interfaces on remote
objects.</p>
<p>QDBusInterface is a generic accessor class that is used to place
calls to remote objects, connect to signals exported by remote
objects and get/set the value of remote properties. This class is
useful for dynamic access to remote objects: that is, when you do
not have a generated code that represents the remote interface.</p>
<p>Calls are usually placed by using the <a href="qdbusabstractinterface.html#call">call</a>() function, which
constructs the message, sends it over the bus, waits for the reply
and decodes the reply. Signals are connected to by using the normal
<a href="qobject.html#connect">QObject.connect</a>() function.
Finally, properties are accessed using the <a href="qobject.html#property">QObject.property</a>() and <a href="qobject.html#setProperty">QObject.setProperty</a>()
functions.</p>
<p>The following code snippet demonstrates how to perform a
mathematical operation of <tt>"2 + 2"</tt> in a remote application
called <tt>com.example.Calculator</tt>, accessed via the session
bus.</p>
<pre class="cpp">
 <span class="type">QDBusInterface</span> remoteApp( <span class="string">"com.example.Calculator"</span><span class="operator">,</span> <span class="string">"/Calculator/Operations"</span><span class="operator">,</span>
                           <span class="string">"org.mathematics.RPNCalculator"</span> );
 remoteApp<span class="operator">.</span><a href="qdbusabstractinterface.html#call">call</a>( <span class="string">"PushOperand"</span><span class="operator">,</span> <span class="number">2</span> );
 remoteApp<span class="operator">.</span><a href="qdbusabstractinterface.html#call">call</a>( <span class="string">"PushOperand"</span><span class="operator">,</span> <span class="number">2</span> );
 remoteApp<span class="operator">.</span><a href="qdbusabstractinterface.html#call">call</a>( <span class="string">"ExecuteOperation"</span><span class="operator">,</span> <span class="string">"+"</span> );
 <span class="type"><a href="qdbusreply.html">QDBusReply</a></span><span class="operator">&lt;</span><span class="type">int</span><span class="operator">&gt;</span> reply <span class="operator">=</span> remoteApp<span class="operator">.</span><a href="qdbusabstractinterface.html#call">call</a>( <span class="string">"PopOperand"</span> );

 <span class="keyword">if</span> ( reply<span class="operator">.</span>isValid() )
     printf( <span class="string">"%d"</span><span class="operator">,</span> reply<span class="operator">.</span>value() );          <span class="comment">// prints 4</span>
</pre><hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDBusInterface" />QDBusInterface.__init__ (<i>self</i>, QString&#160;<i>service</i>, QString&#160;<i>path</i>, QString&#160;<i>interface</i>&#160;=&#160;QString(), <a href="qdbusconnection.html">QDBusConnection</a>&#160;<i>connection</i>&#160;=&#160;QDBusConnection.sessionBus(), <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>Creates a dynamic <a href="qdbusinterface.html">QDBusInterface</a> object associated with the
interface <i>interface</i> on object at path <i>path</i> on service
<i>service</i>, using the given <i>connection</i>. If
<i>interface</i> is an empty string, the object created will refer
to the merging of all interfaces found in that object.</p>
<p><i>parent</i> is passed to the base class constructor.</p>
<p>If the remote service <i>service</i> is not present or if an
error occurs trying to obtain the description of the remote
interface <i>interface</i>, the object created will not be valid
(see <a href="qdbusabstractinterface.html#isValid">isValid</a>()).</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>